<template>
  <div>
    <a-select v-model="value" placeholder="请选择" style="width: 175px" option-label-prop="label" @change="selectClick">
      <a-select-option v-for="(item, index) in dataForm" :key="index" :value="item.name" :label="item.name">
        <div slot="title" style="display: flex; flex-direction: row; justify-content: space-between">
          <div>{{ item.name }}</div>
          <!-- <div>{{ item.cityName }}</div> -->
        </div>
      </a-select-option>
    </a-select>
  </div>
</template>

<script>
import { getAction } from '@/api/manage'
export default {
  props: { value: '' },
  data () {
    return {
      dataForm: [],
      text: undefined
    }
  },
  created () {
    this.init()
  },
  methods: {
    init () {
      getAction('/sys/category/childList', {
        pageNo: 2,
        pageSize: 10,
        pid: '1701159203196026882',
        column: 'createTime',
        order: 'desc',
        field: 'id,,name,code,action'
      }).then(res => {
        if (res.success) {
          this.dataForm = res.result
        }
      })
    },
    selectClick (value) {
      this.$emit('selectClick', value)
    }
  },
  watch: {
    value (val) {
      if (!val) {
        this.text = undefined
      } else {
        return
      }
    }
  }
}
</script>

<style scoped></style>
